package net.oschina.zdc.reactive;

import java.util.Arrays;
import java.util.List;

import rx.Observable;
import rx.functions.Action0;
import rx.functions.Action1;

/**
 * 
 * @author ibm
 *
 */
public class ExampleRx {
    public static void main(String[] args) {
		List<String> list = Arrays.asList("One", "Two", "Three", "Four", "Five");
		Observable<String> observable = Observable.from(list);
		observable.subscribe(new Action1<String>() {
			@Override
			public void call(String element) {
				System.out.println(element);
			}
		}, new Action1<Throwable>() {
			@Override
			public void call(Throwable arg0) {
				System.err.println(arg0);

			}
		}, new Action0() {
			@Override
			public void call() {
				System.out.println("**end**");
			}
		});
	}

}
